package com.example.lawyer.interfaceservice;

import android.database.sqlite.SQLiteDatabase;

import com.example.lawyer.databind.assembly.SlidePageViewData;
import com.example.lawyer.databind.assembly.TypeGridData;
import com.example.lawyer.databind.assembly.TypeNewListData;
import com.example.lawyer.databind.itemview.LawterListItemData;
import com.example.lawyer.databind.itemview.NewListViewData;
import com.example.lawyer.databind.itemview.SlideImageData;
import com.example.lawyer.databind.itemview.TypeGridItemViewData;
import com.example.lawyer.interfacecallback.PageHomeACallback;
import com.example.lawyer.interfacecallback.PageHomeCCallback;
import com.example.lawyer.interfacemethod.PageHomeAInter;

import java.util.ArrayList;
import java.util.List;

public class PageHomeAService implements PageHomeAInter {
    /***
     * 类型数据请求
     * @return
     */
    @Override
    public void InitTypeData(PageHomeACallback callback) {
//        //请求数据
//        RequestTool requestTool = new RequestTool();
//        requestTool.HttpPost()
        //模拟数据

        TypeGridData typeGridData = new TypeGridData();
        List<TypeGridItemViewData> listgrid = new ArrayList<>();
        for(int s=0;s<10;s++) {
            TypeGridItemViewData gridItemViewData = new TypeGridItemViewData();
            gridItemViewData.icon.set( "https://img.zcool.cn/community/01e4ea57a6e2550000018c1bfdce56.jpg");
            gridItemViewData.title.set("测试");
            listgrid.add(gridItemViewData);
        }
        typeGridData.griddata.set(listgrid);
        callback.InitTypeDataList(typeGridData);
    }

    /****
     * 推荐律师数据请求
     * @param callback
     */
    @Override
    public void InitNewListData(PageHomeACallback callback) {
        //请求数据
        //        RequestTool requestTool = new RequestTool();
        //        requestTool.HttpPost()



        TypeNewListData typeNewListData = new TypeNewListData();
        List<LawterListItemData> listViewData = new ArrayList<>();
        for(int i=0;i<10;i++)
        {

            LawterListItemData itemData = new LawterListItemData();
            itemData.lawyerimg.set("https://img.bugela.com/uploads/allimg/20200207/22093612369.jpg");
            itemData.lawyername.set("测试"+i);
            itemData.serverindex.set("98.5");
            itemData.servernumb.set("105");
            itemData.taglist.set("ccccccc");

            listViewData.add(itemData);
        }
        typeNewListData.newlistdata.set(listViewData);
        callback.InitNewDataList(typeNewListData);
    }

    @Override
    public void InitSlideData(PageHomeACallback cCallback) {

        //请求数据


        SlidePageViewData slidePageViewData = new SlidePageViewData();
        List<SlideImageData> imageData = new ArrayList<>();
        for(int s=0;s<10;s++)
        {
            SlideImageData slideImageData1 = new SlideImageData();
            slideImageData1.type.set("App");
            slideImageData1.data.set("{xx}");
            slideImageData1.pagurl.set("https://shp.qpic.cn/ishow/2735083018/1693392052_829394697_42434_sProdImgNo_2.jpg/0");
            imageData.add(slideImageData1);

        }
        slidePageViewData.slidedata.set(imageData);

        cCallback.InitSlideDataList(slidePageViewData);
    }


}
